﻿namespace PerpetuumSoft.InstrumentationPDA
{
    using PerpetuumSoft.InstrumentationPDA.Mathematics;
    using System;
    using System.Drawing;

    public class Meter : CircularControl
    {
        private Color borderCircleColor = Color.Black;
        private Color circleColor = Color.LightSkyBlue;
        private int circleRadius = 90;

        protected override void DrawStatic(Graphics g)
        {
            g.FillEllipse(new SolidBrush(this.CircleColor), new VectorRectangle(base.CenterPoint.X - this.CircleRadius, base.CenterPoint.Y - this.CircleRadius, 2 * this.CircleRadius, 2 * this.CircleRadius).Truncate());
            g.DrawEllipse(new Pen(this.BorderCircleColor), new VectorRectangle(base.CenterPoint.X - this.CircleRadius, base.CenterPoint.Y - this.CircleRadius, 2 * this.CircleRadius, 2 * this.CircleRadius).Truncate());
            base.DrawStatic(g);
        }

        public Color BorderCircleColor
        {
            get
            {
                return this.borderCircleColor;
            }
            set
            {
                if (this.borderCircleColor != value)
                {
                    this.borderCircleColor = value;
                    base.InvalidateStatic();
                }
            }
        }

        public Color CircleColor
        {
            get
            {
                return this.circleColor;
            }
            set
            {
                if (this.circleColor != value)
                {
                    this.circleColor = value;
                    base.InvalidateStatic();
                }
            }
        }

        public int CircleRadius
        {
            get
            {
                return this.circleRadius;
            }
            set
            {
                if (this.circleRadius != value)
                {
                    this.circleRadius = value;
                    base.InvalidateStatic();
                }
            }
        }

        protected override Size DefaultControlSize
        {
            get
            {
                return new Size(200, 200);
            }
        }
    }
}

